/*
 * Created by: Peter Weissbrod
 * Created: Saturday, November 03, 2007
 */
using System;
using System.Security.Cryptography;
using System.Text;

namespace Utils
{
    /// <summary>
    /// just a simple class for obfuscating password strings
    /// </summary>
    public class Crypto
    {
        public static string Hash(string input)
        {
            UnicodeEncoding UE = new UnicodeEncoding();
            byte[] hashValue, messageBytes = UE.GetBytes(input);
            SHA1Managed sha1Managed = new SHA1Managed();
            string strHex = string.Empty;

            hashValue = sha1Managed.ComputeHash(messageBytes);
            foreach (byte b in hashValue)
            {
                strHex += String.Format("{0:x2}", b);
            }
            return strHex;
        }
    }
}